PWD		= $(shell pwd)
VSDLENGINE_PATH	= $(PWD)/../VSDLEngine

CCPREFIX	= 
CC		= $(CCPREFIX)g++
LD		= $(CCPREFIX)ld
NM		= $(CCPREFIX)nm
AS		= $(CCPREFIX)as
AR		= $(CCPREFIX)ar
STRIP		= $(CCPREFIX)strip
OBJDUMP		= $(CCPREFIX)objdump
OBJCOPY		= $(CCPREFIX)objcopy

CFLAGS		= -c -o

ULCORE_OBJS	= ULCore_Algorithm.o ULCore_Balls.o ULCore_Serial.o ULCore_BinFile.o ULCore_History.o ULCore_Statistic.o ULCore_RandomPool.o \
		  ULCore_Prediction.o ULCore_PredictByAC.o 
ULGFX_OBJS	= ULGfx_Balls.o ULGfx_Serial.o ULGfx_History.o ULGfx_BallStatistic.o ULGfx_Statistic.o ULGfx_Bomb.o ULGfx_CrossHair.o
ULUI_OBJS	= ULUI_MenuList.o ULUI_InputPad.o ULUI_MainMenu.o ULUI_HistoryLookup.o ULUI_LookupSingle.o ULUI_LookupRange.o \
		  ULUI_LookupLatest.o ULUI_LookupLatestBlue.o ULUI_StatisticLookup.o ULUI_StatisticFinal.o ULUI_StatisticOut.o \
		  ULUI_StatisticAllFinal.o ULUI_StatisticAllOut.o ULUI_Prediction.o ULUI_PredictFullyRandom.o ULUI_PredictPickLucky.o\
		  ULUI_PredictByAC.o ULUI_UpdateHistory.o ULUI_UpdateTxt.o ULUI_UpdateBin.o ULUI_Help.o 

TARGET		= main
OBJS		= main.o UL_Tools.o  UL_Global.o $(ULCORE_OBJS) $(ULGFX_OBJS) $(ULUI_OBJS)
EXTRA_OBJS	=
LDFLAGS		= -L../VSDLEngine -lsdl -lSDL_ttf -lsprig -lSDL_image 
#DEBUGFLAGS	= -g -DULC_BALLS_DEBUG -DULC_BIN_FILE_DEBUG -DULC_SERIAL_DEBUG -DULC_HISTORY_DEBUG -DULC_RANDOMPOOL_DEBUG -DULC_PREDICTION_DEBUG -DULC_HISTORY_DEBUG 
DEBUGFLAGS	= -g 
INCLUDES	= -I$(PWD)/include -I$(PWD)/include/core -I$(PWD)/include/gfx -I$(PWD)/include/UI -I$(VSDLENGINE_PATH)/include

vpath %.cpp src src/core src/UI src/gfx

$(TARGET):vsdl_engine $(OBJS) $(EXTRA_OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS) $(DEBUGFLAGS)

.PHONY:vsdl_engine
vsdl_engine:
	cd $(VSDLENGINE_PATH) && make clean && make static

%.o:%.cpp
	$(CC) $(INCLUDES) $(CFLAGS) $@ $< $(DEBUGFLAGS)

.PHONY:clean
clean:
	rm -fr $(OBJS) $(EXTRA_OBJS) $(TARGET)

